import { ref } from "vue";
import { getProfitDistribution } from "@/api/cloud";
import { ProfitDistribution } from "@/types/index";

export default function useProfitData(queryTime?: string[]) {
  const profitData = ref<ProfitDistribution>({
    CommodityProfit: 0,
    wages: 0,
    serviceCharge: 0,
    discount: 0,
    freight: 0,
  });

  getProfitDistribution().then((res) => {
    const { data } = res;
    if (data.code === 200 && data.result) {
      profitData.value = data.result;
    }
  });

  return { profitData };
}
